package com.lancoo.answer.model.bean

import com.lancoo.answer.model.AnswerConstant
import com.lancoo.answer.model.entity.ImgRecognitionCollectionBean

/**
 * Created by Dadong on 2021/12/6
 * Describe: 试卷公共结构
 */
open class ExamViewBean(
    var AverageScore: String? = "",//平均分
    var Duration: String? = "",//总用时
    var HighestScore: String? = "",//最高分（考试场景做试卷总分用）
    var Score: String? = "",//试卷得分
    var TypeList: List<Type>? = null,
    //考辅专用
    var PaperID: String? = "",
    var PaperName: String? = "",
    var CurrentIndex: Int = 0, //上次退出的试题下标
    var State: Int = 1 //试卷状态，1-已发布，2-评阅中，3-已完成

)

open class Type(
    var EvalScore: String? = "",//题型得分
    var GenreName: String? = "",//体裁名称
    var OtherName: String? = "", //"string，老师自定义题型名称"
    var TotalScore: String? = "",//题型总分
    var TypeIndex: Int = 0,//题型索引
    var TypeLeader: String? = "",//题型导语
    var TypeName: String? = "",//题型名称
    // 考试字段
    var PartMsg: String? = "",// 2022.2.17新增，试卷作答部分，有听力部分、写作部分等，每个部分的第一个Kind有值。如：Part II Listening Comprehension (30 minutes)
    var SectionMsg: String? = "",// 2022.2.17新增，部分名称，可能为空。如：Section A Talk（大学外语及以上阶段使用）
    var ExampleMsg: String? = "",// 【个性化配置-高职】6.7新增，高职卷示例内容，可能为空
    var ShowTag: Boolean = true//是否显示导语"
) {
    open var QuesList: List<out Ques>? = null //试题详情
        set(value) {
            field = value
        }
        get() {
            return field
        }
}

open class Ques(
    var CustomModel: CustomModel? = null,
    var Duration: String? = "0",//作答用时
    var EvalType: String? = "",//评阅类型：0-选择；1-填空；2-大数据评阅；3-教师评阅
    var GenreID: String? = "",//体裁编号
    var GenreName: String? = "",//体裁名称
    var GenreType: String? = "0",//以下几个字段用于改错题交互，GenreType用于区分短文改错是分句的（GenreType=2）还是不分句的（GenreType=3）
    var ImportKlgList: List<ImportKlg>? = null, //知识点课件
    var IsGetInfor: Boolean = false,//是否获取到笔记
    var LevelType: String? = "",//题型应用类型：0-听力类；1-阅读类；2-词汇语法类；3-翻译写作类
    var MainKlgList: List<MainKlg>? = null, //知识点课件
    var ModelAnswerAreaList: MutableList<ModelAnswerArea>? = null,//改错题作答区间数组
    var ModelAnswerInfoList: MutableList<ModelAnswerInfo>? = null,//改错题数字化答案数组
    var ModelTextInfoList: MutableList<TextInfo>? = null,//改错题题干文本数组
    var NoteID: String = "",
    var OtherName: String? = "", //"string，老师自定义题型名称"
    var QuesBody: String? = "",//试题题干
    var QuesBrief: String? = "",//试题概要
    var QuesID: String? = "",//试题id
    var QuesIndexText: String? = "",// "string，每个试题跟随题干的文本索引，如（A）等，还有听力的passage one等",（个性化需求字段，考辅公共数据结构不会提供）
    var QuesSubLeader: String? = "",//阅读理解-小题导语
    var QuesState: String? = "",//试题状态，0:作答中；1:已提交，2:已过期
    var Scene: String? = "",//[12.2新增]当前场景，0:考辅；1:错题本；2:同类题
    var SortIndexList: List<SortIndex>? = null, //用于答题卡列表
    var TypeName: String? = "",//题型名称
    var TypeNo: String? = "",//题型编号
    var AudioSubLeader: String? = "",//听力题导语（个性化需求字段，考辅公共数据结构不会提供）
    var AudioArticle: String? = "",//听力题全原文
    var AudioPlayTimes: Int = 0,//音频播放次数 （个性化需求字段，考辅公共数据结构不会提供）
    var QuesAnswerTime: Int = 0,//试题复核时长（个性化需求字段，考辅公共数据结构不会提供）
    var AudioList: List<QuesAudio>? = null, //2022.2.16更新，统一采用音频列表的模式合并播放音频，整个试题结构只存在AudioList一个音频字段，范淦的解析会提供一个基础的返回（即大题音频、小题音频1、2、3...，这样返回），如需要定制，则由应用系统覆盖即可
    // 考试字段
    var QuesSectionMsg: String? = "",// 【个性化配置-高职】6.7新增，部分名称，可能为空。如：Task A
    var QuesLeader: String? = "",// 【个性化配置-高职】6.7新增，试题导语，可能为空
    var AudioResumeIndex: Int = 0,//2022.2.16新增，int，恢复作答记录从哪个音频开始播放，从0开始（考试）
    var specialAnswerMethod: Int = 0,// 2022.2.17新增，特殊作答方式：0标准作答，1口语作答
    var IsIndentQuesBody: Boolean = true,// 题干是否缩进
    var IsIndentArticle: Boolean = true,//音频原文是否缩进
    var IsLimitShow: Boolean = false,//是否限制大题显示，默认开放，考试专用
    var IsDigitalPanel: Boolean = true,//:"2022.3.18新增【考试定制】，bool，改错题是否为数字化的显示，默认是true
    //2022/6/7新增
    var SpecialFeatureCodes: String? = "", //用于区分genreId和typeNo一样但是数据结构不一样的匹配题

    var currentLoadChildIndex: Int = 0,//当前默认加载的childIndex
//2022/7/19
    var Comment: String = "", //评语
    var QuesChild_CnOrEng: String = "", //0-英译中，1-中译英，非翻译题，直接空字符串
    var WrongState: Int = 0,
    var IsFavourite: Boolean = false,
    var ScoreRate: Float = 0f, //考辅专用
    var QuesChildNum: Int = 0 //考辅错题本专用
) {
    open var ChildList: List<out Child>? = null //小题层
        set(value) {
            field = value
        }
        get() {
            return field
        }
}

open class Child(
    var ChildAnalysis: String? = "",//小题解析
//    var ChildSortIndex: String? = "",//小题序号 已弃用，可以不用再手动赋值（2022/2/25）
    var ChildAnswer: String? = "",//小题答案
    var ChildAnswerType: Int = 1,//小题作答类型，1：选择，2：填空，4：简答，主要用于复合题区分选择、填空和简答
    var TKAnswerType: Int = 1,//数字化资源库返回的小题作答类型，1-一般式选择，2-填空，4-简答，8录音，16-多选，32-下拉式选择
    var ChildAsk: String? = "",//小题问题
    var ChildAudio: QuesAudio? = QuesAudio(),//小题音频路径 最新结构已移除，不再使用
    var ChildOptionList: ArrayList<ChildOption>? = null,
    var SortIndexType: String? = "",//题号类型，0：以小题抽题，一个小题一个index，1：以答题点抽题，一个答题点一个index
    var EGQuesIndex: Int = 1,
    var ChildAudioPath: String = "",//小题音频路径 过关训练专用
    var IsIndentChildAsk: Boolean = true, //小题题干是否首行缩进
    var IsIndentChildAnswer: Boolean = true,//参考答案是否首行缩进
    // 中学新增,评阅的时候用到，作答提交保存回显均暂时不用
    var StuAnswer: String = "", //学生文本作答
    var DistinguishResult: String = "", //图片识别文本
    var ImagePath: String = "", //，学生图片作答路径，多图片用|分隔"
    var ScanImagePath: String = "",//，答题卡扫描图片路径，有该字段则以扫描图片的展示形式布局"
    var AudioPath: String = "",//学生音频作答路径"
    var AudioDuration: Int = 0, //，学生音频作答总时长"
    var VideoPath: String = "",//学生视频视频路径"
    var VideoThumbnail: String = "",//，学生视频作答缩略图路径"
    var VideoDuration: Int = 0,//，学生视频作答时长"
    var ScoreRate: Float = 0f,//，答题点得分率"
    var TotalScore: Float = 0f, //，答题点总分"
    var EvalScore: Float = 0f,//，答题点得分"
    var State: Int = 0,//，0未评阅，1大数据评阅且老师未评阅，2老师评阅过，3空作答不能评阅"
    var WrittingAnswerType: Int = AnswerConstant.ANSWER_TYPE_TXT_AUDIO,//，作答类型，仅作文和短文听写，1:文本作答（可附带音频）；2:纯图片作答；3:视频作答（课后作业）初始化为1"
    var Comment: String = "",//，作文评语（todo 已废弃）
    var RECNum: Int = 0,//，课后作业优秀学生作答个数"
    var SelectedItemIndex: Int = 0, //二选一作答选中题目序号,默认零（题目一）
    var currentLoadItemIndex: Int = 0, //当前选中的itemIndex
    //2023.12新需求
    var childMark: Boolean = false//是否标记
) {
    open var ItemList: List<Item>? = null
        set(value) {
            field = value
        }
        get() {
            return field
        }
}

open class ModelAnswerArea(
    var AnswerArea: String? = "",
    var Index: Int? = null
)

open class ModelAnswerInfo(
    var Answer: String? = "",
    var Index: Int? = null
)

open class ModelTextInfo(
    var Index: String? = "",
    var Text: String? = ""
)

open class CustomModel(
    var CustomProperty: String? = "",
    var QuesChildNum: Int? = 0,
    var SpecialFeatureCodes: String? = "",
    var TotalItemCount: Int? = null
)

open class ImportKlg(
    var Code: String? = "",
    var Name: String? = "",
    var UniqueCode: String? = ""
)

open class MainKlg(
    var Code: String? = "",
    var Name: String? = "",
    var UniqueCode: String? = ""
)

open class QuesAudio(
    var Path: String? = "",//音频路径
    var Type: Int = 0,//int，类型，0:音频，需要Path赋值，1:间隔时长（如SectionA和试题音频中间的间隔，需要Duration赋值），2:小题作答时长或试题复核时长，需要Duration赋值"
    var Duration: Int = 0,//Type为1、2时，预留的时长，单位秒"

    var childIndex: Int = 0 //temp 测试临时字段
)

open class SortIndex(
    var IsAnswer: Boolean = false,//是否已作答
    var Score: String? = "",//答题点总分
    var ScoreRate: Double? = 0.0,//小题或答题点得分率
    var SortIndex: String? = "",//答题点序号，按整份试卷递增，从1开始
    var State: Int? = -1,//小题或答题点的作答状态，0:未评阅；1大数据评阅且老师未评阅；2:一评阅；3:空作答或不能评阅
    var NewSortIndex: String? = ""//新增字端（new）
)

open class ChildOption(
    var Option: String? = "",
    var OptionIndex: String? = "",
)

open class Item(
    var AudioPath: String? = "",//学生音频作答路径（考试只会用来存播放路径）
    var EvalScore: Float = 0f,//答题点得分
    var ImagePathList: List<String>? = listOf(),//公共试题库中学生图片作答路径
    var IsAnswer: Boolean = false,
    var ItemAnalysis: String? = "",//答题点解析
    var ItemAnswer: String? = "",//答题点答案
    var ItemAskList: List<ItemAsk>? = null,
    var ItemSortIndex: String? = "",//答题点序号
    var ScoreRate: Float = 0f,//答题点得分率
    var SortIndex: String? = "",
    var State: Int = 0,//0未评阅，1大数据评阅且老师未评阅，2老师评阅过，3空作答不能评阅
    var TotalScore: Float = 0f,//答题点总分
    var WrittingAnswerType: Int = AnswerConstant.ANSWER_TYPE_TXT_AUDIO,//试卷作答方式 0-纯文本作答 1-文本+识别作答 2-图片 3-视频作答
    var VideoDuration: Long? = 0,
    var VideoThumbnail: String? = "",
    var VideoPath: String? = "",//学生视频作答路径
    var AudioLocalPath: String? = "",//学生音频作答本地路径（内部字段，调用方禁止使用）
    var ImagePath: String? = "",//作答提交、回显存储字段
    var MutEvaluateScore: Float = -1f, //互评字段
    var RECNum: Int = 0,
    var EGItemIndex: Int = 1,
    var AudioDuration: Long = 0, // 考试会用来存口语题的时长
    var DefaultKeyBoards: List<String>? = null, //过关训练专用
    var SelectedKeyBoards: List<String>? = null, //过关训练专用
    // 考试字段
    var itemIndex: Int = 0, // 答题点全文计数
    //var remoteAudioPath: String? = "", // 考试作答过程用来存远程路径
    var imageAnswer: List<ItemImageAnswer>? = null,// 考试图片作答数据
    var recordAnswer: ItemRecordAnswer? = null,// 考试录音作答数据
    var ScanImagePath: String? = null, // 【考试个性化】3.25新增，string，答题卡扫描图片路径，有该字段则以扫描图片的展示形式布局
    var noteFlag: Int = 0, // 2022.8.5新增，int，有无批注，0:无，1:有
    //图片作答识别存储信息
    var imgRecognitionTxt: String = "",//图片识别文字整体拼接内容
    var imgRecognitionDataList: List<ImgRecognitionCollectionBean>? = null,

    //中学新增字段
    var DistinguishResult: String = "", //图片识别文本
    var Comment: String? = "",//，作文评语
    var DetailComment: DetailComment? = null,//评语详情
    var IsRemark: Boolean = true,//是否是填空题词组分离作答，默认true，不分离"
    var Selected: Boolean = true,//是否是二选一作文的选中题目"
    var ItemName: String = "",//如2选1题型中题目一，要把题目一从ItemAnswer中拆分出来，方便显示和评阅"
    var ItemOptionList: ArrayList<ChildOption>? = null,

    var fouceIndex: Int = -1,//光标记录位置,
    var AnswerPointIndex: Int = 0, //答题点下标 自学专用
    //2023.12新需求
    var itemMark: Boolean = false//是否标记
) {
    open var StuAnswer: String? = ""
        set(value) {
            field = value
        }
        get() {
            if (field == null) {
                return ""
            }
            return field
        }
}

open class ItemAsk {
    var Answer: String? = "" //这个数组用于拆分篇章翻译的句子，当前只有篇章翻译用到，可不传Ask字段
    var Ask: String? = ""
    var AskTip: String? = ""//"string，篇章翻译每个输入框内的前置索引，需和上文中对应"
    var StuAnswer: String? = ""
    var ImagePath: String? = "" //，学生图片作答路径，多图片用|分隔，针对读后续写"
    var AudioPath: String? = "" //，学生音频作答路径，针对读后续写"
    var fouceIndex: Int = -1//光标下标
    var imgRecognitionTxt: String? = ""//图片识别内容
}

// 考试专用
class ItemImageAnswer {
    var imageRemote: String? = null
    var imageLocal: String? = null
    var index: Int = 0 // 图片顺序
}

class ItemRecordAnswer {
    var recordRemote: String? = null
    var recordLocal: String? = null
    var recordDuration: Int = 0 // 录音时长（毫秒）
}